package com.yanfan.ba.utils;

import java.util.HashMap;
import java.util.Map;

public class MapClassifier {
    public static void main(String[] args) {
        Map<String, String> map1 = new HashMap<>();
        Map<String, String> map2 = new HashMap<>();

        // 示例字符串
        String[] inputs = {"17#集水坑", "17#集水坑_1", "17#集水坑_2", "18#集水坑"};

        for (String input : inputs) {
            classifyAndStore(input, map1, map2);
        }

        System.out.println("Map1: " + map1);
        System.out.println("Map2: " + map2);
        String s = StringUtil.classifyAndStore("17集水坑_1");
        System.out.println(s);
    }

    public static void classifyAndStore(String input, Map<String, String> map1, Map<String, String> map2) {
        // 使用正则表达式进行匹配
        if (input.matches(".*集水坑$")) {
            map1.put(input, input);
        } else if (input.matches(".*集水坑_\\d+$")) {
            map2.put(input, input);
        }
    }


}
